let obj = {
  name: 'mike',
  age: '19',
}

function dd(obj) {
  Object.keys(obj).forEach((key) => {
    observe(obj, key, obj[key])
  })
}



function observe(obj, key, val) {
  Object.defineProperty(obj, key, {
    get() {
      console.log('get');
      return val
    },
    set(newVal) {
      console.log('set');
      console.log(`初始值：${val}----更改后的值：${newVal}`);
      val = newVal
    }
  })
}

dd(obj)
console.log(obj.name);
obj.age = 18
console.log(obj);